import string
import random


'''生成随即验证码'''
def generate_captcha(cnt=4):
    letters = string.ascii_letters + string.digits
    captcha = ''.join(random.sample(letters, cnt))
    return captcha